import Vue from 'vue'
import VueRouter from "vue-router";
//1、安装插件
Vue.use(VueRouter)

const Home = () => import('../views/home/Home')
const Category = () => import('../views/category/Category')
const Shopcart = () => import('../views/shopcart/Shopcart')
const Profile = () => import('../views/profile/Profile')


const routes = [
  {
    path: '', //默认首页
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    meta: {
      title: '首页'
    }
  }
  ,
  {
    path: '/category',
    component: Category,
    meta: {
      title: '分类'
    }
  }
  ,
  {
    path: '/shopcart',
    component: Shopcart,
    meta: {
      title: '购物车'
    }
  }
  ,
  {
    path: '/profile',
    component: Profile,
    meta: {
      title: '档案'
    }
  }
]

//2、创建router
const router=new VueRouter({
  routes,
  mode: "history"
})

//、导出
export default router

